package com.wondersgroup.app.appointment.controller;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import net.sf.json.JSONObject;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.github.pagehelper.PageInfo;
import com.wondersgroup.core.frame.BaseController;
import com.wondersgroup.core.frame.CommonStatusResult;

import com.wondersgroup.core.model.Appointment;

import com.wondersgroup.core.resultmap.DTOAppointment;

import com.wondersgroup.core.service.AppointmentService;

import com.wondersgroup.core.util.CustomJacksonObjectMapper;

import com.wondersgroup.core.util.ErrorMessageConstant;
import com.wondersgroup.core.util.InsuranceConstant;

@Controller
@RequestMapping("/appointment")
public class AppointmentController extends BaseController {

    private static Logger LOGGER = LoggerFactory.getLogger(AppointmentController.class);
    
    @Autowired
    private AppointmentService appointmentService;
    
	@Autowired
	private CustomJacksonObjectMapper jacksonObjectMapper;
    
    /**
     * 获取预约列表
     */
    @RequestMapping(value = "/queryAppointmentList/{pageNum}/{pageSize}", method = RequestMethod.POST)
    @ResponseBody
    public CommonStatusResult queryAppointmentList(@RequestParam(required=true) Integer userId,
    		@RequestParam(required=false) Integer customerId,@RequestParam(required=false) Integer companyId,
    		@RequestParam(required=false) Integer hospitalId,@RequestParam(required=false) Integer status,
    		@PathVariable int pageNum, @PathVariable int pageSize) throws InstantiationException {
    	List<DTOAppointment> list = appointmentService.queryAppointmentList(userId, customerId, companyId, hospitalId, status, pageNum, pageSize);
    	PageInfo<DTOAppointment> result = new PageInfo<>(list);
        return CommonStatusResult.success(ErrorMessageConstant.CODE_SUCCESS, result);
    }

   
}
